package com.project.service.impl;

import com.project.mapper.TeacherMapper;
import com.project.pojo.Teacher;
import com.project.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherMapper teacherMapper;
    /**
     * 登陆验证
     *
     * @param teacherId
     * @param password
     * @return
     */
    @Override
    public Teacher login(String teacherId, String password) {
        //调用方法
        Teacher teacher = teacherMapper.login(teacherId, password);
        return teacher;
    }

    /**
     * 查询所有教职工
     *
     * @return
     */
    @Override
    public List<Teacher> selectAllTeacher() {
        //调用方法
        List<Teacher> teacherList = teacherMapper.selectAllTeacher();
        return teacherList;
    }

    /**
     * 添加教职工
     */
    @Override
    public void addTeacher(Teacher teacher) {
        //调用方法
        teacherMapper.addTeacher(teacher);
    }

    /**
     * 更改 教师信息
     *
     * @param teacher
     */
    @Override
    public void updateTeacher(Teacher teacher) {
        teacherMapper.updateTeacher(teacher);
    }

    /**
     * 删除 教职工
     * @param teacherId
     */
    @Override
    public void deleteTeacher(long teacherId) {
        teacherMapper.deleteTeacher(teacherId);
    }
}
